/**
 * 20220114：为支持XR模式，做了简化和改动
 * 20220304:[require] to [import]...jordia
 */
import {MathUtils} from 'three';

/**
 * 选择器配置基类
 */
export default class SelectConfig{
    constructor(values={}){
        this._values=values;
        this._init();
    }

    /**
     * 配置类型
     * @returns {string}
     */
    get type(){
        return 'SelectConfig';
    }

    /**
     * 实例ID
     * @returns {null|string}
     */
    get uuid(){
        return this._uuid;
    }

    /**
     * 销毁
     */
    dispose(){
        this._uuid=null;
    }

    /**
     * 检测对象是否符合此配置
     * @param object
     * @returns {boolean}
     */
    checkType(object){
        console.warn('needs override this method!');
        return false;
    }

    /**
     * 比较对象是否相同
     * @param a
     * @param b
     * @returns {boolean}
     */
    compare(a,b){
        console.warn('needs override this method!');
        return true;
    }

    /**
     * 框选对象的判定
     * @param object
     * @param pointer1
     * @param pointer2
     * @param camera
     * @returns {boolean}
     */
    intersectRect(object,pointer1,pointer2,camera){
        console.warn('needs override this method!');
        return false;
    }

    /**
     * 点选对象的判定
     * @param object
     * @param raycaster
     * @param info {array} 记录相交信息，由近到远顺序排列
     * @returns {boolean}
     */
    intersectPointer(object,raycaster,info){
        console.warn('needs override this method!');
        return false;
    }


    _init(){
        this._initVariable();
        this._uuid=MathUtils.generateUUID();
    }
    _initVariable(){}
}